package nsu.edu.zsq.service.impl.sys;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import nsu.edu.zsq.bean.Course;
import nsu.edu.zsq.bean.Student;
import nsu.edu.zsq.dao.CourseMapper;
import nsu.edu.zsq.dao.StudentMapper;
import nsu.edu.zsq.param.PageQuery;
import nsu.edu.zsq.service.sys.RetakeCourseService;

/** 
* Description: 重修信息管理的service实现类<br>
*/

@Service
public class RetakeCourseServiceImpl implements RetakeCourseService {
    
    @Autowired
    private CourseMapper courseMapper;
    @Autowired
    private StudentMapper studentMapper;

    @Override
    public PageInfo<Course> listRetakeCourseWithPage(PageQuery pageQuery) {
        PageHelper.startPage(pageQuery.getPageNum(),pageQuery.getPageSize());
        List<Course> listRetakeCourse = courseMapper.listRetakeCourse();
        PageInfo<Course> pageInfo = new PageInfo<Course>(listRetakeCourse, pageQuery.getNavigatePages());
        return pageInfo;
    }

    @Override
    public PageInfo<Student> listRetakeStudent(String courseNo, PageQuery pageQuery) {
        PageHelper.startPage(pageQuery.getPageNum(),pageQuery.getPageSize());
        List<Student> listRetakeStudent = studentMapper.listRetakeStudent(courseNo);
        PageInfo<Student> pageInfo = new PageInfo<Student>(listRetakeStudent, pageQuery.getNavigatePages());
        return pageInfo;
    }

}
